package com.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

@TableName("users") // 指定表名
public class User {

    // 使用@TableId注解标记主键，并指定自增类型
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    // 使用@Column注解标记字段映射（可选，因为字段名和列名一致）
    private String username;

    private String password;

    // 如果email字段可以为空，可以添加@Column(nullable = true)注解
    private String email;

    // 标准的getter和setter方法
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    // Override toString方法
    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", email='" + email + '\'' +
                '}';
    }
}